package com.entity;

import com.alibaba.fastjson.JSONObject;
import com.util.VeDate;

// 商品表的实体类
public class Goods {
    private String goodsid = "G" + VeDate.getStringId(); // 生成主键编号
    private String sellerid; // 服装店
    private String goodsname; // 商品名称
    private String cateid; // 商品类型
    private String image; // 图片
    private String price; // 价格
    private String addtime; // 发布日期
    private String hits; // 点击数
    private String sellnum; // 销售数量
    private String contents; // 商品介绍
    private String sellername; // 映射数据
    private String catename; // 映射数据
    private Seller seller;// 多对一映射类
    private Cate cate;// 多对一映射类

    public String getGoodsid() {
        return this.goodsid;
    }

    public void setGoodsid(String goodsid) {
        this.goodsid = goodsid;
    }

    public String getSellerid() {
        return this.sellerid;
    }

    public void setSellerid(String sellerid) {
        this.sellerid = sellerid;
    }

    public String getGoodsname() {
        return this.goodsname;
    }

    public void setGoodsname(String goodsname) {
        this.goodsname = goodsname;
    }

    public String getCateid() {
        return this.cateid;
    }

    public void setCateid(String cateid) {
        this.cateid = cateid;
    }

    public String getImage() {
        return this.image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getPrice() {
        return this.price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getAddtime() {
        return this.addtime;
    }

    public void setAddtime(String addtime) {
        this.addtime = addtime;
    }

    public String getHits() {
        return this.hits;
    }

    public void setHits(String hits) {
        this.hits = hits;
    }

    public String getSellnum() {
        return this.sellnum;
    }

    public void setSellnum(String sellnum) {
        this.sellnum = sellnum;
    }

    public String getContents() {
        return this.contents;
    }

    public void setContents(String contents) {
        this.contents = contents;
    }

    public Seller getSeller() {
        return this.seller;
    }

    public void setSeller(Seller seller) {
        this.seller = seller;
    }

    public Cate getCate() {
        return this.cate;
    }

    public void setCate(Cate cate) {
        this.cate = cate;
    }

    public String getSellername() {
        return this.sellername;
    }

    public void setSellername(String sellername) {
        this.sellername = sellername;
    }

    public String getCatename() {
        return this.catename;
    }

    public void setCatename(String catename) {
        this.catename = catename;
    }


    // 重载方法 生成JSON类型字符串
    @Override
    public String toString() {
        return this.toJsonString();
    }

    //直接转换成JSON字符串
    private String toJsonString() {
        JSONObject jsonString = new JSONObject();
        jsonString.put("goodsid", this.goodsid); // 主键编号
        jsonString.put("sellerid", this.sellerid); // 服装店
        jsonString.put("goodsname", this.goodsname); // 商品名称
        jsonString.put("cateid", this.cateid); // 商品类型
        jsonString.put("image", this.image); // 图片
        jsonString.put("price", this.price); // 价格
        jsonString.put("addtime", this.addtime); // 发布日期
        jsonString.put("hits", this.hits); // 点击数
        jsonString.put("sellnum", this.sellnum); // 销售数量
        jsonString.put("contents", this.contents); // 商品介绍
        jsonString.put("Seller", this.seller); // 多对一映射类
        jsonString.put("Cate", this.cate); // 多对一映射类
        jsonString.put("sellername", this.sellername); // 映射数据
        jsonString.put("catename", this.catename); // 映射数据
        return jsonString.toString();
    }


}




